package cn.tedu;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Demo05 {
    public static void main(String[] args) {
        try (Connection conn = DBUtils.getConn()){
            Statement s = conn.createStatement();
            ResultSet rs = s.executeQuery("select * from car");
            while(rs.next()){
                int id =rs.getInt("id");
                String title = rs.getString("title");
                String type =rs.getString("type");
                int price= rs.getInt("price");
                System.out.println(id+' '+title+' '+type+' '+price);
            }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
    }
}
